<template>
	<SuperTable path="" :columns="columns" :datas="datas">
		<span slot="header-left" style="line-height: 32px;">操作日志</span>
		<Form slot="header-right" :mode="filterForm" inline @submit.native.prevent>
    		<FormItem label="操作人">
    			<Select style="width: 140px">
			        <Option value="a">测试</Option>
			    </Select>
    		</FormItem>
            <FormItem label="操作模块">
            	<Select style="width: 140px">
			        <Option value="a">测试</Option>
			    </Select>
            </FormItem>
            <FormItem label="操作时间">
                <DatePicker type="daterange" format="yyyy-MM-dd" style="width: 200px"></DatePicker>
            </FormItem>
            <Button type="primary" @click="handleSearch">筛选</Button>
    	</Form>
	</SuperTable>
</template>

<script>
import SuperTable from '@/components/SuperTable.vue';
export default {
	name: 'log',
	components: {
		SuperTable
	},
	data() {
		return {
			filterForm: {
				keywords: '',
				brand_id: undefined,
				catid: []
			},
			params: {
				status: '1',
				keywords: '',
				catid: '',
				brand_id: '',
				page: 1,
				limit: 10,
				relations: ['brand']
			},
			datas: [
				{username: 'admin', mode: '订单', datetime: '2018-04-13 22:31:29', content: '编辑订单确认操作'},
				{username: 'admin', mode: '订单', datetime: '2018-04-13 22:31:29', content: '编辑订单确认操作'}
			],
			columns: [
				{
					title: '操作人',
					key: 'username',
					maxWidth: 190
				},
				{
					title: '操作模块',
					key: 'mode',
					maxWidth: 190
				},
				{
					title: '操作时间',
					key: 'datetime',
					maxWidth: 220
				},
				{
					title: '操作内容',
					key: 'content'
				}
			]
		}
	},
	methods: {
		// 搜索
		handleSearch() {
			let cats = this.filterForm.catid;
			if(cats.length > 0) {
				this.params.catid = cats[cats.length - 1];
			}else{
				this.params.catid = '';
			}
			this.params.brand_id = this.filterForm.brand_id || '';
			this.params.keywords = this.filterForm.keywords;
		}
	}
}
</script>

<style>
</style>